package com.jtf.web.link.application;

import javafx.application.Platform;
import org.w3c.dom.Element;

public class BaiduPcApplication  extends BaseApplication{

    protected String keywords;

    protected String url;


    public BaiduPcApplication (String ua, String keywords, String url){
        super("https:/www.baidu.com", ua);
        setTitle("百度搜索");
        this.keywords = keywords;
        this.url = url;
    }



    protected void webLoad(){
        Platform.runLater(()->{
            System.out.println(this.engine.getDocument());
            Element kw = this.engine.getDocument().getElementById("kw");
            System.out.println(kw);
            engine.executeScript("document.getElementById('kw').focus()");
            engine.executeScript("document.getElementById('kw').value = '"+keywords+"'");
            engine.executeScript("document.getElementById('su').click()");
        });


    }

}
